package com.example.mybatisplusdemo;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.mybatisplusdemo.Service.*;
import com.example.mybatisplusdemo.pojo.Good;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class sptest {
    @Autowired
    AdminService adminService;
    @Autowired
    BusinessService bussinessService;
    @Autowired
    UserService userService;
    @Autowired
    CateService cateService;
    @Autowired
    GoodService goodService;
    @Autowired
    CartService cartService;
    @Test
    void testadmin(){
        System.out.println(adminService.list());
    }

    @Test
    void testbus(){
        System.out.println(bussinessService.list());
    }

    @Test
    void checktoken(){
        System.out.println(userService.checktoken("123123"));
    }

    @Test
    void getcate(){
        System.out.println(cateService.list());
    }

    @Test
    void getgoods(){
        System.out.println(goodService.list());
    }

    @Test
    void gettotalprice(){
        int price = Integer.parseInt(goodService.getOne(new QueryWrapper<Good>().eq("id",1)).getPrice());
        System.out.println(5*price);
    }

    @Test
    void testcart(){
        System.out.println(cartService.list());
    }
}
